package com.zhuoshi.action;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zhuoshi.bean.Wd_opening_reportModel;
//import com.zhuoshi.service.Wd_ht_projectModelService;
import com.zhuoshi.service.Wd_opening_reportModelService;

@Controller
@RequestMapping("/opening-report")
public class Wd_Opening_reportAction {
	
	
	@Autowired
private Wd_opening_reportModelService opening_reportService;
	//@Autowired
//private Wd_ht_projectModelService projectModelService;
	
	@RequestMapping("report.do")
	public String Opening_reportList(Model model){
		List<Wd_opening_reportModel> reportList = opening_reportService.selectOpeningReport();
		System.out.println("================="+reportList+"-------------");
		model.addAttribute("reportList",reportList);
		return "reportList";
	}
	
	@RequestMapping("addReport.do")
	public String addReport(){
		
		//System.out.println("++++++++++kkkkkkkkkkkkkkkkkkkkk");
		return "addReport";
	}
	@RequestMapping("home.do")
	public String Home(){
		System.out.println("_____home++++");
		return "room";
	}
	@RequestMapping("addHome.do")
   public String addHome(){
	   return "addHome";
   }
	@RequestMapping("addPrice.do")
	public String addPrice(){
		return "addPrice";
	}
	@RequestMapping("discount.do")
	public String discount(){
	return "discount";	
	}
	@RequestMapping("payType.do")
	public String payType(){
		return "payType";
	}
	@RequestMapping("commit.do")
	public String commit(){
		return "addReport";
	}
	@RequestMapping("priceMx.do")
	public String priceMx(){
		return "priceMx";
	}
	@RequestMapping("outExcel.do")
	public String outExcel(){
		List<String> header = new ArrayList<String>();//表头信息list
		header.add("序号");
		header.add("开盘报告名称");
		header.add("报告类型");
		header.add("房间状态");
		List<String[]> report=new ArrayList<String[]>();
		List<Wd_opening_reportModel> reportList = opening_reportService.selectOpeningReport();
		 for(Wd_opening_reportModel bean:reportList){
			 String[] str=new String[]{};
			str[0]=bean.getOpeningReportName();
			str[1]=bean.getReportType();
			str[2]=bean.getState();			
			 report.add(str);
		 }
		 //boolean result = ExcelExportCollege.exportExcel(header, report);
		return "redirect:report.do";
	}
	@RequestMapping("likeReport.do")
	public String LikeReport(String openingReportName,Model model){
		//System.out.println("/////////////////"+openingReportName);
		List<Wd_opening_reportModel> reportList = opening_reportService.likeOpeningReport(openingReportName);
		model.addAttribute("reportList",reportList);
		return "reportList";
	}
}
